<?php
class Catalog_model extends CI_Model{
	public $table_name = "catalog";
	public function getall(){
        $query = $this->db->get($this->table_name);
        return $query->result();
    }
    public function get_one($id){
    	$query = $this->db->where("id",$id)->get($this->table_name);
    	return $query->row(); 
    }
    public function add_one($data){
        $this->db->insert($this->table_name, $data);
    }
    public function edit_one($id,$data){
        $query = $this->db->where("id",$id)->update($this->table_name,$data);
    }
    public function del($id){
        $this->db->where("id",$id)->delete($this->table_name);
    }
}